package com.jsu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jsu.mapper.ActivityMapper;
import com.jsu.mapper.AgendaMapper;
import com.jsu.mapper.FlowSpeakerMapper;
import com.jsu.mapper.SpeakerMapper;
import com.jsu.service.SpeakerService;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.example.model.activity.pojo.Activity;
import org.example.model.activity.pojo.Agenda;
import org.example.model.activity.pojo.FlowSpeaker;
import org.example.model.common.dtos.ResponseResult;
import org.example.model.user.pojo.Speaker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.Date;
import java.util.List;

@Service
@Slf4j
public class SpeakerServiceImpl implements SpeakerService {

    @Autowired
    private FlowSpeakerMapper flowSpeakerMapper;
    @Autowired
    private SpeakerMapper  speakerMapper;
    @Autowired
    private AgendaMapper  agendaMapper;


    @Override
    public ResponseResult getSpeaker(Date date,Integer type) {
        List<Speaker> speakers ;
        //拿到全部
        if (date==null&&type==null){
            speakers = speakerMapper.selectList(null);
        }
        else if (date!=null&&type==null){
            speakers = speakerMapper.selectSpeakerByDate(date);

        }
        else if (date==null&&type!=null){

            speakers = speakerMapper.selectSpeakerByType(type);
        }
        else {

            speakers = speakerMapper.selectSpeakerByDateAndType(date,type);
        }
        return ResponseResult.okResult(speakers);
    }

    @Override
    public ResponseResult getAllSpeaker() {
        List<Speaker> speakers = speakerMapper.selectList(null);
        return ResponseResult.okResult(speakers);
    }

    @Override
    public ResponseResult getSpeakerById(Integer speakerId) {
        Speaker speaker = speakerMapper.selectById(speakerId);
        return ResponseResult.okResult(speaker);
    }
}
